<!-- 文件名：product_form.html -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head><title>添加商品</title></head>
<body>
<form th:action="@{/products(username=${user.username})}" method="post" th:object="${product}">
  名称：<input type="text" th:field="*{name}"/><br/>
  <div th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></div>

  价格：<input type="text" th:field="*{price}"/><br/>
  <div th:if="${#fields.hasErrors('price')}" th:errors="*{price}"></div>

  <button type="submit">保存</button>
</form>

<a th:href="@{'/products?username=' + ${user.username}}">返回商品列表</a>
</body>
</html>
